package code.example.base.util.concurrent.lock.speed;

import code.example.base.util.concurrent.lock.Counter;

import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.ReentrantLock;

public class LockSpeed extends SpeedTest  {

    ReentrantLock lock = new ReentrantLock();



    public void lockRun(SpeedRunnable speedRunnable){
        lock.lock();
        try{
           // long startTime = System.currentTimeMillis();
            speedRunnable.run();
          //  System.out.println("run on time:"+(System.currentTimeMillis()-startTime));
        }finally {
            lock.unlock();
        }
    }


    public static void main(String args []){
        System.out.println("LockSpeed:");
        new LockSpeed().startTest();
    }


}
